CREATE TABLE [asgmvc].[log_id_seq] ( 
	[id]   	int IDENTITY(1,1) NOT NULL,
	[vapor]	int NULL 
	)
GO



CREATE TABLE [dbo].[l_genre] ( 
	[genre_id]	int IDENTITY(1,1) NOT NULL,
	[genre]   	varchar(50) NOT NULL 
	)
GO

SET IDENTITY_INSERT [dbo].[l_genre] ON
GO
INSERT INTO [dbo].[l_genre]([genre_id], [genre])
  VALUES(1, 'Comedy')
GO
INSERT INTO [dbo].[l_genre]([genre_id], [genre])
  VALUES(2, 'Horror')
GO
INSERT INTO [dbo].[l_genre]([genre_id], [genre])
  VALUES(3, 'Science Fiction')
GO
INSERT INTO [dbo].[l_genre]([genre_id], [genre])
  VALUES(4, 'Romance')
GO
INSERT INTO [dbo].[l_genre]([genre_id], [genre])
  VALUES(5, 'Bad')
GO
INSERT INTO [dbo].[l_genre]([genre_id], [genre])
  VALUES(6, 'Fantasy')
GO
SET IDENTITY_INSERT [dbo].[l_genre] OFF
GO

ALTER TABLE [dbo].[l_genre]
	ADD CONSTRAINT [PK_l_genre]
	PRIMARY KEY ([genre_id])
GO

CREATE TABLE [dbo].[t_application_log] ( 
	[id]      	int IDENTITY(1001,1) NOT NULL,
	[logtime] 	datetime NOT NULL,
	[ident]   	varchar(200) NOT NULL,
	[priority]	int NOT NULL,
	[message] 	text NULL 
	)
GO

ALTER TABLE [dbo].[t_application_log]
	ADD CONSTRAINT [PK_t_application_log]
	PRIMARY KEY ([id])
GO

CREATE TABLE [dbo].[t_movies] ( 
	[movie_id]        	int IDENTITY(1,1) NOT NULL,
	[title]           	varchar(100) NOT NULL,
	[genre_id]        	int NOT NULL,
	[box_office_gross]	float NULL,
	[opening_screens] 	int NULL,
	[director]        	varchar(100) NULL,
	[opening_date]    	datetime NULL,
	[genre2_id]       	int NULL 
	)
GO

SET IDENTITY_INSERT [dbo].[t_movies] ON
GO
INSERT INTO [dbo].[t_movies]([movie_id], [title], [genre_id], [box_office_gross], [opening_screens], [director], [opening_date], [genre2_id])
  VALUES(5, 'Star Wars: A New Hope', 3, 1.0E9, 200, 'George Lucas;\"\"', '19770501 00:00:00', NULL)
GO
INSERT INTO [dbo].[t_movies]([movie_id], [title], [genre_id], [box_office_gross], [opening_screens], [director], [opening_date], [genre2_id])
  VALUES(6, 'Star Wars: The Phantom Menace', 5, 1000000.0, 2000, 'George Lucas', '20000101 00:00:00', NULL)
GO
INSERT INTO [dbo].[t_movies]([movie_id], [title], [genre_id], [box_office_gross], [opening_screens], [director], [opening_date], [genre2_id])
  VALUES(7, 'City Lights', 3, 999.0, 251, 'Charlie Chaplin', '20000101 00:00:00', NULL)
GO
INSERT INTO [dbo].[t_movies]([movie_id], [title], [genre_id], [box_office_gross], [opening_screens], [director], [opening_date], [genre2_id])
  VALUES(8, 'Scream', 2, 999.0, 2500, 'Wes Craven', '20000101 00:00:00', NULL)
GO
INSERT INTO [dbo].[t_movies]([movie_id], [title], [genre_id], [box_office_gross], [opening_screens], [director], [opening_date], [genre2_id])
  VALUES(9, 'Blade Runner 2000', 1, 9999.0, 301, 'Ridley Scott', '20000101 00:00:00', NULL)
GO
INSERT INTO [dbo].[t_movies]([movie_id], [title], [genre_id], [box_office_gross], [opening_screens], [director], [opening_date], [genre2_id])
  VALUES(10, 'The General', 1, 200000.0, 201, 'Buster Keaton', '20000101 00:00:00', NULL)
GO
INSERT INTO [dbo].[t_movies]([movie_id], [title], [genre_id], [box_office_gross], [opening_screens], [director], [opening_date], [genre2_id])
  VALUES(11, 'Harry and the Hendersons', 1, 2000000.0, 200, 'Oliver Stone', '19890412 00:00:00', NULL)
GO
INSERT INTO [dbo].[t_movies]([movie_id], [title], [genre_id], [box_office_gross], [opening_screens], [director], [opening_date], [genre2_id])
  VALUES(15, 'Platoon', 2, 2222.0, 12, 'Oliver Stone', '20060216 00:00:00', NULL)
GO
SET IDENTITY_INSERT [dbo].[t_movies] OFF
GO

ALTER TABLE [dbo].[t_movies]
	ADD CONSTRAINT [PK_t_movies]
	PRIMARY KEY ([movie_id])
GO

ALTER TABLE [dbo].[t_movies]
	ADD CONSTRAINT [FK_t_movies_l_genre1]
	FOREIGN KEY([genre2_id])
	REFERENCES [dbo].[l_genre]([genre_id])
	ON DELETE NO ACTION 
	ON UPDATE NO ACTION 
GO

ALTER TABLE [dbo].[t_movies]
	ADD CONSTRAINT [FK_t_movies_l_genre]
	FOREIGN KEY([genre_id])
	REFERENCES [dbo].[l_genre]([genre_id])
	ON DELETE NO ACTION 
	ON UPDATE NO ACTION 
GO

CREATE TABLE [dbo].[t_pagecontent] ( 
	[pagecontent_id]	int IDENTITY(1001,1) NOT NULL,
	[page]          	varchar(50) NOT NULL,
	[pagecontent]   	text NOT NULL 
	)
GO

SET IDENTITY_INSERT [dbo].[t_pagecontent] ON
GO
INSERT INTO [dbo].[t_pagecontent]([pagecontent_id], [page], [pagecontent])
  VALUES(1001, 'hello', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet.')
GO
SET IDENTITY_INSERT [dbo].[t_pagecontent] OFF
GO

ALTER TABLE [dbo].[t_pagecontent]
	ADD CONSTRAINT [PK_t_pagecontent]
	PRIMARY KEY ([pagecontent_id])
GO

CREATE TABLE [dbo].[t_users] ( 
	[user_id] 	int NOT NULL,
	[username]	int NOT NULL,
	[fname]   	varchar(150) NOT NULL,
	[lname]   	varchar(150) NOT NULL,
	[status]  	varchar(20) NULL 
	)
GO

